package com.hspedu.poly_.test;

/**
 * @author 谷其昊
 * @version 1.0
 * @date 2022/1/23
 * @time 0:58
 */
public class ExtendsTheory {
    public static void main(String[] args) {
        Son son = new Son();
        System.out.println(son.name);
        System.out.println(son.age);
        System.out.println(son.hobby);
        System.out.println(son.getName());
    }
}

class GrandPa {
    String name = "大头爷爷";
    String hobby = "旅游";

    public String getName() {
        return name;
    }
}

class Father extends GrandPa {
    String name = "大头爸爸";
    int age = 39;
}

class Son extends Father {
    String name = "大头儿子";
}
